home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / xrobots / xrobots.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  4KB  |  172 lines

  1. /*
  2.  * xrobots.h  --  xrobots
  3.  * 
  4.  * Copyright 1989 Brian Warkentine
  5.  * 
  6.  * Permission to use, copy, modify, distribute, and sell this software and its
  7.  * documentation for any purpose is hereby granted without fee, provided that
  8.  * the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the author's name not be used in advertising or
  11.  * publicity pertaining to distribution of the software without specific,
  12.  * written prior permission.  The author makes no representations about the
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  * 
  16.  * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE 
  18.  * AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
  19.  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
  20.  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
  21.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22.  * 
  23.  * The author's current employer has no connection with this software, as it
  24.  * was written before being employed at Sun.  The following address is for 
  25.  * contacting the author only and does not imply any responsibility on the 
  26.  * behalf of Sun Microsystems.
  27.  * 
  28.  * Contact the author at:
  29.  *     Brian Warkentine  (brianw@Sun.COM)
  30.  *     Sun Microsystems
  31.  *     2550 Garcia Avenue
  32.  *     Mountain View, Ca 94043-1100
  33.  *
  34.  */
  35.  
  36. #ifdef NO_RANDOM
  37. #define random rand
  38. #define srandom srand
  39. #endif
  40. /* 
  41.  * from main.c
  42.  */
  43. extern Display     *display;
  44. extern Window     playfield;
  45. extern Widget     playfield_widget;
  46. extern GC     gc,
  47.         cleargc;
  48. extern Pixel     fg, 
  49.         bg;
  50. extern Boolean     spiffy,
  51.         autoteleport,
  52.         autoteleportalways,
  53.         showjumps,
  54.         diewaiting;
  55. extern unsigned int
  56.         chasetime;
  57.  
  58. extern void     update_score();
  59.  
  60. /*
  61.  * from graphics.c
  62.  */
  63. extern XtEventHandler redisplay_level();
  64.  
  65. extern void     init_pixmaps(), 
  66.         auto_teleport(),
  67.         display_possible_moves(), 
  68.         display_level(), 
  69.         update_pointer(), 
  70.         free_pixmaps(), 
  71.         do_death(), 
  72.         show_teleport(), 
  73.         show_sonic(), 
  74.         show_movement();
  75.  
  76. #define CELLSIZE 21
  77.  
  78. #define pos_to_coord( _pos_ ) (( _pos_ ) * CELLSIZE + 5)
  79.  
  80. /*
  81.  * from actions.c
  82.  */
  83.  
  84. extern void         sonic_action(),
  85.             reset_sonic_button();
  86.  
  87. extern XtActionProc    do_nothing_action(),
  88.             move_action(),
  89.             jump_action(),
  90.             go_here_action();
  91.  
  92. extern XtEventHandler     pointer_moved();
  93.  
  94. extern int          determine_direction();
  95.  
  96. /*
  97.  * from score.c
  98.  */
  99.  
  100. #ifndef SCORE_FILE
  101. #  define SCORE_FILE "/usr/games/lib/xrobotscores"
  102. #endif
  103.  
  104. #ifndef MAXSCORES
  105. #  define MAXSCORES 20
  106. #endif
  107.  
  108. extern void     check_score(), 
  109.         create_high_score_popup();
  110.  
  111. extern void    show_scores_callback();
  112.  
  113. extern char *score_filename;
  114.  
  115. /*
  116.  * from game.c
  117.  */
  118.  
  119. #ifndef MAXX
  120. #     define     MAXX 35
  121. #endif
  122. #ifndef MAXY
  123. #      define     MAXY 20
  124. #endif
  125.  
  126. #define EMPTY     0
  127. #define ROBOT     1
  128. #define HEAP      2
  129. #define REDRAW     3
  130.  
  131. #define LEFT    1
  132. #define RIGHT   2
  133. #define UP      4
  134. #define DOWN    8
  135. #define STILL   16
  136.  
  137. #define for_each    for(x=0;x<MAXX;x++) \
  138.               for(y=0;y<MAXY;y++)
  139.  
  140. /* I know, I KNOW... global variables! */
  141.  
  142. extern int     human_x, human_y,
  143.                last_human_x, last_human_y;
  144.  
  145. extern int    robot_array[MAXX][MAXY],
  146.         robot_array_bak[MAXX][MAXY];
  147.  
  148. extern int     score,
  149.         num_robots,
  150.         game_active,
  151.         sonic_used;
  152.  
  153. #define MIN(a,b) ((a<b)?a:b)
  154. #define MAX(a,b) ((a>b)?a:b)
  155.  
  156. #define INXRANGE( _x_ )  (((_x_) >=0) && ((_x_)<MAXX))
  157. #define INYRANGE( _y_ )  (((_y_) >=0) && ((_y_)<MAXY))
  158.  
  159. extern void     new_game(), 
  160.         add_score(), 
  161.         new_level();
  162. extern int      chase();
  163. extern void     undo_chase(), 
  164.         teleport(), 
  165.         sonic_screwdriver(), 
  166.         wait_for_em();
  167. extern int      can_go();
  168.  
  169.  
  170.  
  171.  
  172.